using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Configuration;

namespace FoundationLib.Ifc.Authorisation.Configuration
{
	/// <summary>
	/// This class represents the settings for directory services authorisation.
	/// </summary>
	public class AuthorisationConfigSection : ConfigurationSection
	{
		/// <summary>
		/// Creates a new instance.
		/// </summary>
		public AuthorisationConfigSection()
			: base()
		{
		}

		/// <summary>
		/// Loads the configuration section.
		/// </summary>
		/// <returns>The configuration section</returns>
		public static AuthorisationConfigSection FromConfiguration()
		{
			return (ConfigurationManager.GetSection("authorisationConfiguration") as AuthorisationConfigSection);
		}

		/// <summary>
		/// Gets the directory service settings.
		/// </summary>
		[ConfigurationProperty("services", IsRequired = true)]
		[ConfigurationCollection(typeof(AuthorisationConfigCollection), 
			AddItemName = "add", RemoveItemName = "remove", ClearItemsName = "clear")]
		public AuthorisationConfigCollection Services
		{
			get
			{
				return (this["services"] as AuthorisationConfigCollection);
			}
		}
	}
}
